#include "script/glue/LuaGlue.h"
#include "script/glue/lua/Common.h"
#include "App.h"

class App;

namespace LuaGlue
{

	int App::create(lua_State *L)
	{
		lua_pushstring(L, "App is not meant to be constructed");
		return 1;
	}

	int App::getCamera(lua_State *L)
	{
//		lua_pop(L,1);
		Ogre::Camera* cam = ::App::getInstance().getCamera();
		if(!cam) return 0;
		Wrapper<Camera>::Instance(L, (void*)cam);
		return 1;
	}

	int App::loadScene(lua_State *L)
	{
//		lua_pop(L,1);
		const char* file = luaL_checkstring(L, 1);
		::App::getInstance().loadSceneXml(file);
		return 1;
	}

	int App::run(lua_State *L)
	{
//		bool b = ::App::getInstance().run();
//		lua_pushboolean(L, true);
		return 1;
	}
	
	int App::frameTime(lua_State *L) 
	{
		lua_pushinteger(L, ::App::getInstance().getFrameTime());
		return 1;
	}
}

DECLARE(App)
META(App)
METHODS(App)
method(LuaGlue::App, run),
method(LuaGlue::App, loadScene),
method(LuaGlue::App, getCamera),
//method(LuaGlue::App, frameTime),
END
